<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
</body>
<script>
    <script src="plug/layui/layui.js"></script>
    <script>
        table.on('tool(test)'),function (obj){
            if(obj.event ==='edit'){
                window.open("/pc/index/edit?account_id=" + obj.data.account_id);
        }
            if(obj.event == 'del') {
                layui.jquery.ajax({
                    //接口地址
                    url: "/api/account/del?id=" + obj.data.account_id,
                    //提交方式
                    type: "GET",
                    //成功回调
                    success: function (data) {
                        if (data === "1") {
                            //代表后端返回数据正常，数据成功写入数据库了
                            alert("添加成功")
                            window.close();
                            return;
                        }
                        alert(data);
                    },
                    //失败回调
                    error: function (data) {
                        alert("接口异常，请稍后再试~");
                    }
                });
                return false;
            })
        })
</script>
</body>
</html>